﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGeEntity2d : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGeEntity2d(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGeEntity2d obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGeEntity2d()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGeEntity2d(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public bool isKindOf(OdGe.EntityId entType)
		{
			bool result = GlobalsPINVOKE.OdGeEntity2d_isKindOf(this.swigCPtr, (int)entType);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGe.EntityId type()
		{
			OdGe.EntityId result = (OdGe.EntityId)GlobalsPINVOKE.OdGeEntity2d_type(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeEntity2d copy()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGeEntity2d_copy(this.swigCPtr);
			OdGeEntity2d result = (intPtr == IntPtr.Zero) ? null : new OdGeEntity2d(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeEntity2d Assign(OdGeEntity2d entity)
		{
			GlobalsPINVOKE.OdGeEntity2d_Assign(this.swigCPtr, OdGeEntity2d.getCPtr(entity));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return this;
		}

		public bool IsEqual(OdGeEntity2d entity)
		{
			bool result = GlobalsPINVOKE.OdGeEntity2d_IsEqual(this.swigCPtr, OdGeEntity2d.getCPtr(entity));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool IsNotEqual(OdGeEntity2d entity)
		{
			bool result = GlobalsPINVOKE.OdGeEntity2d_IsNotEqual(this.swigCPtr, OdGeEntity2d.getCPtr(entity));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isEqualTo(OdGeEntity2d other, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.OdGeEntity2d_isEqualTo__SWIG_0(this.swigCPtr, OdGeEntity2d.getCPtr(other), OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isEqualTo(OdGeEntity2d other)
		{
			bool result = GlobalsPINVOKE.OdGeEntity2d_isEqualTo__SWIG_1(this.swigCPtr, OdGeEntity2d.getCPtr(other));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeEntity2d transformBy(OdGeMatrix2d xfm)
		{
			GlobalsPINVOKE.OdGeEntity2d_transformBy(this.swigCPtr, OdGeMatrix2d.getCPtr(xfm));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return this;
		}

		public OdGeEntity2d translateBy(OdGeVector2d translateVec)
		{
			OdGeEntity2d result = new OdGeEntity2d(GlobalsPINVOKE.OdGeEntity2d_translateBy(this.swigCPtr, OdGeVector2d.getCPtr(translateVec).Handle), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeEntity2d rotateBy(double angle, OdGePoint2d basePoint)
		{
			GlobalsPINVOKE.OdGeEntity2d_rotateBy__SWIG_0(this.swigCPtr, angle, OdGePoint2d.getCPtr(basePoint));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return this;
		}

		public OdGeEntity2d rotateBy(double angle)
		{
			GlobalsPINVOKE.OdGeEntity2d_rotateBy__SWIG_1(this.swigCPtr, angle);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return this;
		}

		public OdGeEntity2d mirror(OdGeLine2d line)
		{
			GlobalsPINVOKE.OdGeEntity2d_mirror(this.swigCPtr, OdGeLine2d.getCPtr(line));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return this;
		}

		public OdGeEntity2d scaleBy(double scaleFactor, OdGePoint2d basePoint)
		{
			OdGeEntity2d result = new OdGeEntity2d(GlobalsPINVOKE.OdGeEntity2d_scaleBy__SWIG_0(this.swigCPtr, scaleFactor, OdGePoint2d.getCPtr(basePoint)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeEntity2d scaleBy(double scaleFactor)
		{
			OdGeEntity2d result = new OdGeEntity2d(GlobalsPINVOKE.OdGeEntity2d_scaleBy__SWIG_1(this.swigCPtr, scaleFactor), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isOn(OdGePoint2d point, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.OdGeEntity2d_isOn__SWIG_0(this.swigCPtr, OdGePoint2d.getCPtr(point), OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isOn(OdGePoint2d point)
		{
			bool result = GlobalsPINVOKE.OdGeEntity2d_isOn__SWIG_1(this.swigCPtr, OdGePoint2d.getCPtr(point));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
